import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

// 将路由模块注册到Vue模块
Vue.use(VueRouter)

// 创建路由对象
const routes = [
  {
    path: '/',      // 指定路由地址
    alias: '/home', // 路由别名，如果通过路由别名跳转，router-link的to值不一致会导致当前项样式失效
    name: 'home',   // 路由名字，用来做命名路由
    component: HomeView   // 对应路由要渲染的页面组件
  },
  // {
  //   path: '/home',
  //   redirect: "/"       // 路由重定向
  // },
  {
    path: '/square',
    name: 'square',
    component: () => import(/* webpackChunkName: "square" */ '../views/Square.vue')
  },
  {
    path: '/qa',
    name: 'qa',
    component: () => import(/* webpackChunkName: "qa" */ '../views/QA.vue')
  },
  {
    path: '/system',
    name: 'system',
    component: () => import(/* webpackChunkName: "system" */ '../views/System.vue')
  },
  {
    path: '/detail/:id/:abc/:qwe',
    name: 'detail',
    component: () => import(/* webpackChunkName: "system" */ '../views/Detail.vue')
  },
  {
    path: '/project',
    name: 'project',
    component: () => import(/* webpackChunkName: "project" */ '../views/Project.vue')
  }
]

// 创建路由对象
const router = new VueRouter({
  routes
})

// 暴露路由模块
export default router
